home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / triton / examples / toolmanager1.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-01-01  |  4.0 KB  |  160 lines

  1. Program ToolManager1;
  2.  
  3. (*
  4.  *  OpenTriton -- A free release of the triton.library source code
  5.  *  Copyright (C) 1993-1998  Stefan Zeiger
  6.  *
  7.  *  This program is free software; you can redistribute it and/or modify
  8.  *  it under the terms of the GNU General Public License as published by
  9.  *  the Free Software Foundation; either version 2 of the License, or
  10.  *  (at your option) any later version.
  11.  *
  12.  *  This program is distributed in the hope that it will be useful,
  13.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *  GNU General Public License for more details.
  16.  *
  17.  *  You should have received a copy of the GNU General Public License
  18.  *  along with this program; if not, write to the Free Software
  19.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  *  Toolmanager1.c - Looks like the original ToolManager
  22.  *
  23.  *)
  24.  
  25. {
  26.    A demo in FPC Pascal using triton.library
  27.  
  28.    nils.sjoholm@mailbox.swipnet.se
  29. }
  30.  
  31. uses exec, triton, tritonmacros, amigalib, utility, vartags, linklist;
  32.  
  33.  
  34.  
  35. const
  36.      cycle_entries : array [0..7] of PChar = ('Exec','Image','Sound','Menu','Icon','Dock','Access',NIL);
  37.  
  38.      liststrings : array [0..8] of PChar = (
  39.                      '2024view' ,
  40.                      'Add to archive',
  41.                      'Delete',
  42.                      'Edit text',
  43.                      'Env',
  44.                      'Exchange',
  45.                      'Global Help System',
  46.                      'Multiview',
  47.                      'Paint');
  48.  
  49. var
  50.    i : Longint;
  51.    LVList : pList;
  52.    MyNode : pFPCNode;
  53.    Triton_App : pTR_App;
  54.  
  55. procedure CleanUp(why : string; err : longint);
  56. begin
  57.     if assigned(Triton_App) then  TR_DeleteApp(Triton_App);
  58.     if assigned(LVList) then DestroyList(LVList);
  59.     if why <> '' then writeln(why);
  60.     halt(err);
  61. end;
  62.  
  63. begin
  64.     CreateList(LVList);
  65.     FOR i := 0 TO 8 DO BEGIN
  66.         MyNode := AddNewNode(LVList,liststrings[i]);
  67.     END;
  68.  
  69.     Triton_App := TR_CreateApp(TAGS(
  70.                                TRCA_Name,longstr('ToolManagerGUIDemo1'),
  71.                                TRCA_LongName,longstr('ToolManager GUI demo 1'),
  72.                                TRCA_Info,longstr('Looks like the original ToolManager'),
  73.                                TAG_END));
  74.  
  75.     if Triton_App = nil then CleanUp('Can''t create application',20);
  76.  
  77.       ProjectStart;
  78.       WindowID(0); WindowPosition(TRWP_BELOWTITLEBAR);
  79.       WindowTitle('ToolManager GUI demo 1'); WindowFlags(TRWF_NOSIZEGADGET OR TRWF_NODELZIP OR TRWF_NOZIPGADGET OR TRWF_NOESCCLOSE);
  80.       WindowBackfillNone;
  81.  
  82.       VertGroupA;
  83.  
  84.         Space;
  85.  
  86.         HorizGroupAC;
  87.           Space;
  88.           TextID('_Object Type',1);
  89.           Space;
  90.           CycleGadget(@cycle_entries,0,1);
  91.           Space;
  92.         EndGroup;
  93.  
  94.         Space;
  95.  
  96.         HorizGroupAC;
  97.           Space;
  98.             VertGroupAC;
  99.               CenteredTextID('Object List',2);
  100.               Space;
  101.               ListSSCN(LVList,2,0,0);
  102.             EndGroup;
  103.           Space;
  104.             VertGroupA;
  105.               TextN('');
  106.               Space;
  107.               Button('Top',3);
  108.               Space;
  109.               Button('Up',4);
  110.               Space;
  111.               Button('Down',5);
  112.               Space;
  113.               Button('Bottom',6);
  114.               Space;
  115.               Button('So_rt',7);
  116.             EndGroup;
  117.           Space;
  118.         EndGroup;
  119.  
  120.         Space;
  121.  
  122.         HorizGroupEA;
  123.           Space;
  124.           Button('_New...',8);
  125.           Space;
  126.           Button('_Edit...',9);
  127.           Space;
  128.           Button('Co_py',10);
  129.           Space;
  130.           Button('Remove',11);
  131.           Space;
  132.         EndGroup;
  133.  
  134.         Space;
  135.  
  136.         HorizGroupEA;
  137.           Space;
  138.           Button('_Save',12);
  139.           Space;
  140.           Button('_Use',13);
  141.           Space;
  142.           Button('_Test',14);
  143.           Space;
  144.           Button('_Cancel',15);
  145.           Space;
  146.         EndGroup;
  147.  
  148.         Space;
  149.  
  150.       EndGroup;
  151.  
  152.       EndProject;
  153.  
  154.     i := TR_AutoRequest(Triton_App,NIL,@tritontags);
  155.     CleanUp('',0);
  156. end.
  157.  
  158.  
  159.  
  160.